package com.shr.leetcode;

import java.util.Arrays;
/**
 * leetcode 561
 * @author sevn
 *
 */
public class ArrayPatition {
	
    public static int arrayPairSum(int[] nums) {
        Arrays.sort(nums);
        int sum =  0;
        for(int i = 0; i<nums.length; i += 2){
        	sum += nums[i] ;
        }
        return sum ;
    }
	
	
	public static void main(String[] args) {
		int[] a = {4,3,2,1};
		System.out.println(arrayPairSum(a));
	}
}
